package com.jsjvm.server.dbgproxy.jdwp.cmdsets;

import java.io.IOException;

import com.jsjvm.server.dbgproxy.JDWPCommandSet;
import com.jsjvm.server.dbgproxy.jdwp.data.JDWPInputStream;
import com.jsjvm.server.dbgproxy.jdwp.data.JDWPOutputStream;
import com.jsjvm.server.dbgproxy.jdwp.data.JDWPRequestHeader;
import com.jsjvm.shared.vmcmds.VMCommand;

@SuppressWarnings("serial")
public class JDWPObjectReferenceCommandSet extends JDWPCommandSet {
    private static final int REFERENCE_TYPE_CMD			= 1;
    private static final int GET_VALUES_OBJ_CMD			= 2;
    private static final int SET_VALUES_OBJ_CMD			= 3;
    private static final int MONITOR_INFO_CMD			= 5;
    private static final int INVOKE_METHOD_OBJ_CMD		= 6;
    private static final int DISABLE_COLLECTION_CMD		= 7;
    private static final int ENABLE_COLLECTION_CMD		= 8;
    private static final int IS_COLLECTED_CMD			= 9;
    private static final int REFERRING_OBJECTS_CMD		= 10;

    public static final int OBJECT_REFERENCE_SET = 9;
    
	@Override
	public int getCommandSetNumber() {
		return OBJECT_REFERENCE_SET;
	}
	
	public JDWPObjectReferenceCommandSet() {
		this.put(REFERENCE_TYPE_CMD, new ReferenceType());
		this.put(MONITOR_INFO_CMD, JDWPCommandSet.getNIHandler());
		this.put(REFERRING_OBJECTS_CMD, JDWPCommandSet.getNIHandler());
	}
	
	// FIXME ReferenceType not implemented -- type of the object
	private static class ReferenceType extends JDWPCommandHandler {
		@Override
		public VMCommand handleCommand(JDWPRequestHeader hdr, JDWPInputStream is,
				JDWPOutputStream os) throws IOException {
			int id = is.readID();
			System.out.println("requested type of ID " + id);
			//os.replyWithError(hdr, (short)99);
			return null;
		}
	}
	

}
